//Togglers
$(document).ready(function(){

		//Hide (Collapse) the toggle containers on load
		$(".toggle_container").hide(); 

		//Switch the "Open" and "Close" state per click then slide up/down (depending on open/close state)
		$("h4.trigger").click(function(){
			$(this).toggleClass("active").next().slideToggle("fast");
			return false; //Prevent the browser jump to the link anchor
		});

	});
	
//jCarouselLite
$(function() {
    $(".latest-work").jCarouselLite({
        btnNext: ".lwork-next",
        btnPrev: ".lwork-prev",
		visible: 4,
		scroll: 4,
		easing: "easeInOutBack", // list of options http://gsgd.co.uk/sandbox/jquery/easing/
		speed: 1000
    });
});

//Cufon
$(document).ready(function(){
			Cufon.replace('h1, h2, h3.home-title span ');
});

//SuperFish
jQuery(function(){
	 // This initializes the Superfish menu.
	 jQuery('ul.sf-menu').superfish();
 });
 
 //prettyPhoto
$(document).ready(function(){
	$("a[rel^='prettyPhoto']").prettyPhoto();
});

//Quicksand
jQuery(document).ready(function(jQuery){
    // Clone applications to get a second collection
    var $data = jQuery(".filter-posts").clone();
    
    jQuery('.filter-list li').click(function(e) {
        
        jQuery(".filter li").removeClass("active"); 
        // Use the last category class as the category to filter by.
        var filterClass=jQuery(this).attr('class').split(' ').slice(-1)[0];
        
        if (filterClass == 'all-projects') {
            var $filteredData = $data.find('.project');
        } else {
            var $filteredData = $data.find('.project[data-type~=' + filterClass + ']');
        }
        jQuery(".filter-posts").quicksand($filteredData, {
            duration: 400,
            easing: 'jswing',
			adjustHeight: 'auto'
        });     
        jQuery(this).addClass("active");            
        return false;
    });
});